package com.plian.system.dao.cqzc.bondissue;

import com.plian.Tools.pagedata.PageData;
import com.plian.system.dao.DaoSupport;
import com.plian.system.model.page.Page;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
* 说明：债券发行
*/
@Component
public class  bondIssueDao {
@Resource(name = "daoSupport")
private DaoSupport dao;

	/**
	* 新增
	* @param pd
	* @throws Exception
	*/
	public void save(PageData pd) throws Exception {
		dao.save("bondIssueMapper.save",pd);
	}

	/**
	* 修改
	* @param pd
	* @throws Exception
	*/
	public void edit(PageData pd) throws Exception {
		dao.update("bondIssueMapper.edit",pd);
	}

	/**
	* * 根据Id获取一条数据
	* @param id
	* @return
	* @throws Exception
	*/
	public PageData findbyid(String id) throws Exception {
		return (PageData) dao.findForObject("bondIssueMapper.findbyid",id);
	}

	/**
	 * * 根据issueName获取一条数据
	 * @param issueName
	 * @return
	 * @throws Exception
	 */
	public PageData findByIssueName(String issueName) throws Exception {
		return (PageData) dao.findForObject("bondIssueMapper.findByIssueName",issueName);
	}
	/**
	* 列表
	* @return
	* @throws Exception
	*/
	public List<PageData> listPage(Page page) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.listPage",page);
	}
	public List<PageData> issueList(Page page) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.issueListPage",page);
	}
	/**
	* 批量删除
	* @return
	* @throws Exception
	*/
	public void del_ids(List<String> ids) throws Exception {
		dao.delete("bondIssueMapper.del_ids",ids);
	}
	/**
	* 修改状态
	* @param pd
	*/
	public void  refer(PageData pd) throws Exception {
		dao.update("bondIssueMapper.refer",pd);
	}
	/**
	* 根据多个id查询
	* @param pd
	*/
	public List<PageData> findByIds(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.findByIds",pd);
	}
	/**
	* 报表查询
	* @param pd
	*/
	public List<PageData> reportList(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.reportList",pd);
	}
	public List<PageData> reportListPage(Page page) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.reportListPage",page);
	}
	public List<PageData> list(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.list",pd);
	}

	/**
	 * 查询年度下列表
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public List<PageData> yearList(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.yearList",pd);
	}
	public List<PageData> listIssuance(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("bondIssueMapper.listIssuance",pd);
	}

	/**
	 * 截止日期，累计已发放金额
	 * @param pd
	 * @return
	 * @throws Exception
	 */
	public String sumIssuance(PageData pd) throws Exception {
		return (String) dao.findForObject("bondIssueMapper.sumIssuance",pd);
	}

	/**
	 * 获取当前日期前所有未偿还的列表
	 * @return
	 * @throws Exception
	 */
	public List<PageData> noRepaymentList() throws Exception{
		return (List<PageData>) dao.findForList("bondIssueMapper.noRepaymentList", null);
	}

}